//#########################################################################
//                              WackiEngie
//           Copyright (c) 2014 Marc Wacker. All rights reserved.
//#########################################################################

#pragma once

#include "WeUtilPrerequisites.h"

namespace WackiEngine
{

	template<class T>
	class Matrix2 {
	protected:
		T	_m[2][2];

	public:
		Matrix2(const T m0 = 1, const T m1 = 0,
			const T m2 = 0, const T m3 = 1);
		Matrix2(const Matrix2 &A);

		Matrix2(const T degAng, const T rx, const T ry);	//rotation constructor

		void setMatrix(	const T m0 = 1, const T m1 = 0,
						const T m2 = 0, const T m3 = 1);
		void setMatrix(const Matrix2 &A);

		//getters
		T* m() { return _m; }
		T m(uint32 row, uint32 col)	{ return _m[row][col]; }

	};


	template<class T>
	Matrix2<T>::Matrix2(const T m0 = 1, const T m1 = 0,
		const T m2 = 0, const T m3 = 1)
	{
		setMatrix(m0, m1, m2, m3);
	}
	template<class T>
	Matrix2<T>::Matrix2(const Matrix2 &A)
	{
		setMatrix(A);
	}

	template<class T>
	Matrix2<T>::Matrix2(const T degAng, const T rx, const T ry)
	{
		// TODO implement
	}

	template<class T>
	void Matrix2<T>::setMatrix(const T m0 = 1, const T m1 = 0,
		const T m2 = 0, const T m3 = 1)
	{
		_m[0][0] = m0;
		_m[0][1] = m1;
		_m[1][0] = m2;
		_m[1][1] = m3;

	}
	template<class T>
	void Matrix2<T>::setMatrix(const Matrix2 &A)
	{
		setMatrix(A._m[0][0], A._m[0][1], A._m[1][0], A._m[1][1]);
	}



	typedef Matrix2<float> Matrix2f;

}